/*    */ package com.zimbra.cs.iochannel;
/*    */ 
/*    */ import com.google.common.collect.ImmutableSet;
/*    */ import com.zimbra.common.iochannel.Config;
/*    */ import com.zimbra.common.iochannel.Config.ServerConfig;
/*    */ import com.zimbra.common.service.ServiceException;
/*    */ import com.zimbra.cs.account.Provisioning;
/*    */ import com.zimbra.cs.account.Server;
/*    */ import java.util.Collection;
/*    */ import java.util.HashSet;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class ZcsConfig
/*    */   extends Config
/*    */ {
/*    */   private final Config.ServerConfig localConfig;
/*    */   private final HashSet<Config.ServerConfig> peerServers;
/*    */   
/*    */   public ZcsConfig()
/*    */     throws ServiceException
/*    */   {
/* 31 */     Provisioning prov = Provisioning.getInstance();
/* 32 */     Server localServer = prov.getLocalServer();
/* 33 */     this.peerServers = new HashSet();
/*    */     
/* 35 */     this.localConfig = new Config.ServerConfig(localServer.getServiceHostname(), null, localServer.getMessageChannelPort());
/* 36 */     for (Server s : prov.getAllServers()) {
/* 37 */       if ((!s.isLocalServer()) && (s.hasMailboxService()) && (s.isMessageChannelEnabled())) {
/* 38 */         this.peerServers.add(new ZcsServerConfig(s));
/*    */       }
/*    */     }
/*    */   }
/*    */   
/*    */   public Config.ServerConfig getLocalConfig()
/*    */   {
/* 45 */     return this.localConfig;
/*    */   }
/*    */   
/*    */   public Collection<Config.ServerConfig> getPeerServers()
/*    */   {
/* 50 */     return ImmutableSet.copyOf(this.peerServers);
/*    */   }
/*    */   
/*    */   private static final class ZcsServerConfig
/*    */     extends Config.ServerConfig
/*    */   {
/*    */     public ZcsServerConfig(Server s)
/*    */     {
/* 58 */       super(s.getServiceHostname(), s.getMessageChannelPort());
/*    */     }
/*    */   }
/*    */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/iochannel/ZcsConfig.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */